package day5;

import java.io.FileInputStream;

/**
 * @author oldliu
 * @since 1.0
 */
public class FileRead2 {
    public static void main(String[] args) {

        FileInputStream fin = null;
        try {
            fin = new FileInputStream
                    ("F:\\java76\\yangshuo\\FileTest5.java");
            byte[] b = new byte[10];
            int length=0;
            while ((length=fin.read(b))!=-1){
                //System.out.println("读取了："+length+"个字节！");
                String str=new String(b,0,length);
                System.out.print(str);
            }
        } catch (java.io.IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (fin != null)
                    fin.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
